<!DOCTYPE html>
<html lang="zh">
<html xmlns:th="http://www.thymeleaf.org">
<head th:replace="common/header :: header(~{::title},~{::link},~{})">
    <title>点餐</title>
    <link rel="icon" th:href="@{/assets/img/lcxm.ico}" type="image/ico">
</head>
<body class="body">
<!--导航-->
<div th:replace="common/nav :: nav(true)"></div>

<div class="container">

    <div class="row">
        <div style="margin-top: 20px;"></div>
        <div class="row">

            <form class="form-horizontal validate" role="form" method="post" th:action="@{/project/save}"
                  onsubmit="return checkForm(this);">

                <!-- 操作信息提示的地方 -->
                <div th:if="${remind}" class="alert alert-${ remind.level  }"
                     th:classappend="'alert-' + ${remind.level}">
                    <button data-dismiss="alert" class="close" type="button">
                        <i class="glyphicon glyphicon-remove"></i>
                    </button>
                    <span th:remove="tag" th:utext="${ remind.message }"></span>
                </div>

                <div class="col-sm-12 col-sm-offset-0">
                    <table class="table table-striped table-condensed table-bordered stable">
                        <caption>个人信息</caption>
                        <tbody>
                        <tr class="success">
                            <th>姓名</th>
                            <th>日期</th>
                        </tr>
                        <tr class="text-center text-danger lead">
                            <td th:text="${day.user?.userName}">name</td>
                            <td th:text="${day.day}+'('+${date.getName()}+')'">status</td>
                        </tr>
                    </table>
                    <input type="hidden" id="day" th:value="${day.day}">

                </div>
                <div class="col-sm-12 col-sm-offset-0">
                    <div class="action-bar">
                        <a class="btn btn-sm btn-primary" id="addRow" title="新增工时">
                            <i class="glyphicon glyphicon-plus"></i> 新增一行
                        </a>
                        <a class="btn btn-sm btn-success" id="addReport" title="新增工时">
                            <i class="glyphicon glyphicon-plus"></i> 弹窗增工时
                        </a>
                    </div>

                    <table class="table table-striped  table-hover table-bordered stable">
                        <caption>工时记录(
                            <th:block th:text="${day?.reports.size()}+'条'"/>
                            ),共计
                            <th:block th:text="${day?.duration+'分钟'}"/>
                        </caption>
                        <thead>
                        <tr class="text-center">
                            <th>项目</th>
                            <th>JIRA</th>
                            <th>工时(分钟)</th>
                            <th>内容</th>
                            <th class="text-info">操作</th>
                        </tr>
                        </thead>
                        <tbody align="center" id="tbody">
                        <tr th:each="cur:${day?.reports}">
                            <td th:text="${cur.projectName}"></td>
                            <td th:text="${cur.jira}"></td>
                            <td th:text="${cur.duration}">100</td>
                            <td th:title="${cur.content}" data-toggle="tooltip"
                                th:text="${#strings.abbreviate(cur.content,20)}">content
                            </td>
                            <td>
                                <div class="btn-group-dis">
                                    <button class="btn btn-xs btn-danger action-post"
                                            type="button"
                                            th:attr="data-url='/report/delete/'+${cur.id}"
                                            data-toggle="tooltip"
                                            title="删除" data-confirm="确定删除吗?">
                                        <i class="glyphicon glyphicon-trash"></i>
                                        <i class="action-param" data-key="date" th:attr="data-value=${day.day}"></i>
                                    </button>
                                </div>
                            </td>
                        </tr>
                        <!-- </c:forEach> -->
                        <tr class="hidden" id="templateTr">

                                <th>
                                    <select class="form-control"  name="projectId"
                                            onChange="fillRowJiraPrefix(this)"
                                            data-rule-required="true">
                                        <option value="">--请选择--</option>
                                        <option th:each="item:${projects}" th:value="${item.id}"
                                                th:text="${item.text + ' (' + item.pid+')'}"
                                                th:attr="data-jira-prefix=${item.pid}"></option>
                                    </select>
                                </th>
                                <th>
                                    <input type="text" class="form-control"  name="jira" value=""
                                           onBlur="checkRowJiraPrefix(this)"
                                           onFocus="checkRowProject(this)"
                                           placeholder="注意和项目的jira前缀保持一致" autocomplete="off"/>
                                </th>
                                <th>
                                    <input type="number" class="form-control"  name="duration" v
                                           placeholder="单位:分" autocomplete="off" />
                                </th>
                                <th>
                                    <textarea class="form-control"  name="content"  data-rule-required="true"
                                              placeholder="工作内容, 包括完成度" autocomplete="off" rows="5"></textarea>
                                </th>
                                <th class="text-info">
                                    <button class="btn btn-xs btn-primary" type="button"
                                            onclick="addRowReport(this)"
                                            data-toggle="tooltip"
                                            title="保存工时" data-confirm="确定新增吗?">
                                        <i class="glyphicon glyphicon-saved"></i>
                                    </button>
                                    <button class="btn btn-xs btn-danger" type="button"
                                            onclick="delRowReport(this)"
                                            data-toggle="tooltip"
                                            title="删除新增" >
                                        <i class="glyphicon glyphicon-trash"></i>
                                    </button>
                                </th>
                        </tr>
                        </tbody>
                    </table>
                </div>


                <div class="form-group clearfix">
                    <div class="col-sm-offset-4 col-sm-8">
                        <button th:if="${remind == null}" type="submit" class="btn btn-lg btn-primary">
                            <i class="glyphicon glyphicon-ok"></i> 提交
                        </button>
                        <a type="button" class="btn btn-lg  btn-info" th:href="@{/report/}">
                            <i class="glyphicon glyphicon-repeat"></i> 返回
                        </a>
                    </div>
                </div>


            </form>

        </div>


    </div>
</div>

<!-- 引入通用js-->
<div th:replace="common/footer :: footer"></div>
<script th:src="@{/js/report/report.js}"></script>
<script>
    function checkForm(form) {

        return true;
    };





</script>

</body>
</html>